package com.hnevc.caoliuye;

import java.util.Scanner;

public class Homework {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入鸡和兔的总数量：");
        int i = scanner.nextInt();
        System.out.println("请输入鸡和兔的总腿数：");
        int y = scanner.nextInt();
        jitu(i, y);
    }

    public static void jitu(int i, int y) {
        int count = 1;//鸡
        for (count = 1; count < i; count++) {
            if ((count * 2 + (i - count) * 4) == y) {
                System.out.println(count);
                System.out.println(i - count);
            } else {
                System.out.println("NO answer");
            }
        }
    }
}
